#pragma once

#include "Main.h"
#include "ClientSocket.h"
using namespace std;

#include "HTTPRequestInfo.h"
#include "HTTPResponseHeaders.h"

#include "lua/lua.hpp"
#include "luna/luna.h"

class CScriptInteraction
{
public:
	CScriptInteraction(Client *aClient, HTTPRequestInfo *aRequestInfo, HTTPResponseHeaders *aResponseHeaders);
	CScriptInteraction(lua_State *L);
	~CScriptInteraction(void);


	int Send(string Value);

	bool Header(string Name, string Value);

	string ServerVariable(string Name);
	string GetVariable(string Name);
	string PostVariable(string Name);

	int LuaSend(lua_State *L);
	int LuaHeader(lua_State *L);
	int LuaGetVariable(lua_State *L);
	int LuaServerVariable(lua_State *L);
	int LuaPostVariable(lua_State *L);

	vector<pair<string, string>> mVariables;
	vector<pair<string, string>> mGet;
	vector<pair<string, string>> mPost;

//private:
	Client *mClient;
	HTTPRequestInfo *mRequestInfo;
	HTTPResponseHeaders *mResponseHeaders;

	static const char className[];
	static const Luna<CScriptInteraction>::RegType Register[];
};

